home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
DOSIMP12.ARJ
/
SIMPLY7.HYP
< prev
next >
Wrap
Text File
|
1992-01-16
|
112KB
|
1,976 lines
The |TAPPEND|T Command
This command is a TSR that works just like the PATH command, only for
data files instead of executable files. If your current directory is
C:\WORD and you want to do something with the file C:\WORD\LETTER.DOC,
that's easy. You just say LETTER.DOC. But if C:\WORD is not the current
directory, then you have to say \WORD\LETTER.DOC in order to access that
file. Well this is no longer the case, ever since the |nAPPEND|n command
came on the scene in DOS version 3.2. If you had previously issued the
command |nAPPEND|n C:\WORD then you can just say LETTER.DOC, no matter what
your current directory is, and DOS will be able to find the file.
There is a big problem with this, though. DOS can use the |nAPPEND|n method
to find the file, but it can't use it to write the file back to disk. So
if any changes are made to the file after it has been found via the AP-
PEND method, the new copy of the file will be written into the current
directory. The original copy of the file is still right where it was,
only without today's changes. Now if you make some more changes to the
file tomorrow, and you had started from some other directory, then by the
<page down> for more APPEND
end of tomorrow you'll have three copies of your LETTER.DOC file sitting
on your disk, but all three of them are incomplete. You still have the
original copy in the C:\WORD directory, but it is missing yesterday's and
today's changes. Then you have the copy that was created yesterday, that
has yesterday's changes but not today's changes. And finally you have
today's copy, which is the original with today's changes, but not yester-
day's changes. Three copies of the same file, in three different direc-
tories, and all of them are wrong. So what's so great about the |nAPPEND|n
command?
Well it does have its uses, but you just have to think for a minute about
what you're doing, before you use it. First, you'll need to find out for
sure which files on your disk ever get modified. See, you're not the on-
ly one who ever modifies your files. Your programs do some modifying of
their own files from time to time. So to find out, do a complete BACKUP,
which turns off the Archive attributes for all your files, then use your
computer normally for a couple weeks, and then do this:
ATTRIB \*.* /S || FIND " A " > PRN
That will send, to your printer, a list of every file on the disk that
<page down> for more APPEND
has been modified since the BACKUP. Make sure to leave a <Space> on each
side of the capital A inside the quotes, or it won't work.
You never want to put the directories that contain these changeable files
on your |nAPPEND|n command line. But you can use it for any directory that
doesn't contain changing files. Suppose you keep all your word procces-
sor's program files in your C:\WORD directory, and you keep all the doc-
uments that you create with your word processor, in a subdirectory called
C:\WORD\DOCS. Suppose also that none of the files in your C:\WORD direc-
tory came up on that list of changeable files. Then you can put the C:\
WORD directory on your PATH, and also on your |nAPPEND|n line. And you can
change to your C:\WORD\DOCS directory (with the CHDIR command) before
each time you start your word processor. This way, all the files you
might change with the word processor are in the current directory, so
they'll get written back to the proper place, but you can still access
the word processor's executable files (via the |sPATH|s) and it can access
its |soverlay|ss (via the |nAPPEND|n line), and everybody will be happy.
The syntax for this command is exactly like that for the PATH command.
<page down> for The |nASSIGN|n Command
The |TASSIGN|T Command
Here's a command you won't be using too often. It is a TSR that is used
to change all references to one drive, to another drive. This is useful
for installing programs that insist on being installed from a disk in
drive A:. Well, what if you got the software on 3.5" disks, and your
3.5" drive is drive B:? Here's where the |nASSIGN|n command comes in. If
you were to issue the command |nASSIGN|n A=B then every time the installation
program requests a read from drive A:, DOS will send the program to drive
B: instead and you will probably be able to install with no problem.
This command is not all roses, though. It can be very dangerous! Don't
use it unless you have a complete BACKUP of your hard drive as well as
any floppies you may be using while the |nASSIGN|n command is in effect.
Then, disable the assignment just the second you're done with whatever
you were doing that required the assignment. To do that, just enter
|nASSIGN|n with no parameters.
That really is not just hot air. Don't leave an assignment active for
<page down> for more ASSIGN
one single minute longer than you have to. All sorts of terrible things
can happen. Some DOS commands or programs might ignore the assignment,
and perform the specified command on the A: disk when you meant for the
command to happen to the B: drive. On the other hand, if you forget that
you have an assignment made, and perform some command that does not ig-
nore the assignment, you'll end up once again having that command per-
formed on the wrong disk. For example, what if, after you've given the
command |nASSIGN|n A=C, then you forget that you've done that, and put a disk
into drive A: and enter DEL A:*.*? Know what's going to happen? All the
files in the current directory of drive C: will be deleted.
And any TSR that is resident while an |nASSIGN|n is active, including DOS's
PRINT command, can do some serious damage to your data. And if you goof
up and use DOS's BACKUP command on an assigned drive, it might act like
it's working, but when you go to RESTORE the backup disks, you may find
that your backup disks are worthless.
If for any reason you find that you need to use the |nASSIGN|n command on a
regular basis to make one particular application work with your setup, do
<page down> for more ASSIGN
it from a batch file. Have the batch file make the assignment, then run
the app, and then undo the assignment. That way you'll never forget to
unassign, because the batch file always remembers for you.
If you already have one assignment made, and you issue another |nASSIGN|n
command to make another assignment, the second one will cancel the first
one. But you can make two assignments with one |nASSIGN|n command, so that's
ok. Just do something like |nASSIGN|n A=C B=C. You can even reverse two
drives with |nASSIGN|n A=B B=A.
Notice that this command is one of the only times where you are supposed
to reference a drive letter without using a colon (:). |nASSIGN|n A=B is
correct, but |nASSIGN|n A:=B: is not. (Well, in DOS version 5 it is ok.)
If you have DOS version 3.1 or later, use the SUBST command instead of
|nASSIGN|n. It's not the safest command in the world either, but it's sure
safer than |nASSIGN|n! If you have the SUBST command you should just delete
the |nASSIGN|n.COM file from your hard drive, so you don't forget and use it.
<page down> for more ASSIGN
DOS version 5 adds the /STATUS switch to this command. If you enter the
command |nASSIGN|n /STATUS then DOS will tell you what assignments you've
made, that are still active.
<page down> for The |nATTRIB|n Command and File |nAttributes|n
The |TATTRIB|T Command and File |tAttributes|t
The syntax for this command is as follows:
|nATTRIB|n +a FILENAME.EXT
where "a" can be the initial of any one of the four file |nattributes|n, and
the + is for turning the attribute on. To turn one off, use - instead.
But DOS versions previous to 5 can only work with the R and A |nattributes|n.
If you need to alter an H or S attribute and you have an older version of
DOS, there are many utilities that can do it, such as PC Tools, Norton,
and several public domain or freeware ones such as HIDE.COM from PC Mag-
azine.
A very little-known use for the |nATTRIB|n command, is to search your hard
drive for a file. If you use the |nATTRIB|n command without any +a or -a,
it will just show you the names of the specified files, with their at-
tributes displayed next to each. An extra benefit of this is that the
file's entire |spath|sname is included! So now you know in which directory
that file resides! For example, suppose you have a file named ABCDEF.EXE
and you can't remember where it is. Go to the root directory and use the
<page down> for more ATTRIB and Attributes
command |nATTRIB|n ABCDEF.EXE /S and the /S tells |nATTRIB|n to search not only
the current directory, but also every subdirectory below the current one,
so if you start from the root, the whole drive will be searched. The re-
sult may be this:
A R C:\DOS\ABCDEF.EXE
Now you see that the file is in the \DOS directory. (And that it has its
Archive and Read-only |nattributes|n turned on.)
The |nATTRIB|n command also fully supports wildcards. For example, you can
set the R attribute of every .EXE file on the drive with the command AT-
TRIB +R *.EXE /S, if you do it from the root directory. Or, if you want
to find every .BAT file you have on the drive, |nATTRIB|n \*.BAT /S will show
you their full file specifications, even if you're not in the root direc-
tory because the backslash (\) tells DOS to start the search in the root.
In DOS version 5, this command works on H and S |nattributes|n as well as A
and R ones. But you can't do anything with a file that has H and/or S
until those two |nattributes|n are gone. If you have a file with all four
|nattributes|n, and you want to remove the A, for example, you can't do it
<page down> for more ATTRIB and Attributes
while the file has H and S, so |nATTRIB|n -H -S -A FILE.EXT will do it. If
you wanted that file to keep its H and S, then put them back with |nATTRIB|n
+H +S FILE.EXT. Yes, it is ok to change more than one attribute on one
command line like that.
A file can have any of four |nattributes|n. The |nattributes|n for each file are
stored in the directory. The possible |nattributes|n are |nHidden|n, System, Ar-
chive, and Read-only. (The word "attributes" can also refer to screen
colors, but that has nothing to do with this meaning of the word.)
|tHidden|t files can be executed, but they cannot be deleted, updated, cop-
ied, or even seen in a directory listing. Many programs give a |nHidden|n
attribute to their most important files, on the assumption that since you
can't see them in a directory listing, you won't know they're there, and
you won't try to mess with them. DOS has two |nHidden|n files named IO.SYS
and MSDOS.SYS for MS-DOS, or IBMBIO.COM and IBMDOS.COM for PC-DOS.
The System attribute is quite similar to the |nHidden|n one.
<page down> for more ATTRIB and Attributes
The |tArchive|t attribute is turned on every time a file is created, copied
into a directory, or updated in any way via normal DOS function calls.
The main purpose of this is so that a BACKUP program can tell which files
need to be backed up (archived). Most backup programs turn the |nArchive|n
attribute off each time they backup a file, so the program knows that if
the |nArchive|n attribute is on, the file has been changed since the last
backup was done and needs to be backed up (archived) again.
Most people think that there's no reason to mess with |nArchive|n |nattributes|n,
but that's just plain silly. If you backup your drive often, which turns
off all the |nArchive|n |nattributes|n, then you can tell a lot about what goes
on by looking to see which files have had their A |nattributes|n turned back
on. You can tell which programs change which files. You can tell wheth-
er it's time to do a new backup. You can tell whether shelling out to
DOS has netted you any stray temp files, more easily than if you had to
just search the whole disk for them, because any temp files will defin-
itely have A |nattributes|n. (Unless you backed them up, which you certainly
didn't want to do!) All sorts of things. And there are lots of times
when you want to remove an A attribute from a file. If you'll notice,
<page down> for more ATTRIB and Attributes
this book's *.INX files are always getting their A |nattributes|n turned on.
That's because of the method the HLPURSLF program uses to work with those
files. DOS just thinks that an important change has been made, so it
turns on the A attribute. But you have absolutely no need to go backing
up the .INX files all the time. So you want to remove their A |nattributes|n
before each time you backup, so that the BACKUP command doesn't try to
back them up. There are lots of files that get modified in some way,
that don't need to be backed up. Like the CPSC.TRE file that PC Tools
version 7's PCShell uses. It's just a copy of your disk's directory
structure, that PCShell uses to do its work a little faster. It wouldn't
make a bit of sense to backup that file. So turn off its A attribute be-
fore you backup so it won't get backed up. (Of course, this only applies
to incremental backups, because those are the ones that use the A attrib-
ute. A full backup backs up everything with or without an A attribute.)
See the last part of the APPEND chapter for a little more information
about Archive |nattributes|n, and also the XCOPY chapter.
A file which has its Read-only attribute set can be executed, read, re-
named, or copied, but can't be deleted or updated. Setting the R attrib-
<page down> for more ATTRIB and Attributes
ute is a good way to save your files from accidental deletion. If you
try to delete a file that has an R attribute, you'll get "|tAccess denied|t".
(See also the end of the Directory chapter.)
However, some programs will search for certain companion files that they
need in order to run, and if the companion file has its R attribute set
to on, the program might think the file is missing. So if you ever run a
program which says, "I cannot find my |toverlay|t file named ABCDEF.OVL, I am
aborting myself", even though you can see that the file is in the current
directory, just turn the R attribute for that file off, and the program
should run just fine.
<page down> for The |nBACKUP|n Command
The |TBACKUP|T Command
How important is it to backup your hard disk? Well, how hard is it for
you to get your files all organized the way you want them? How hard is
it for you to create your data files in your word processor, spreadsheet,
database, or whatever other type of programs you use? Do you want to
take the very real chance that it could all be lost, and you'll be right
back to square one, when there's something you can do to prevent it? Of
course backing up is a pain! Most worthwhile things are. But once you
have done it a couple times, it won't be confusing anymore. You'll get
the hang of it in no time flat. Make it a habit, and just like all hab-
its, it will become second nature.
Some people think that backing up program files is pointless, since they
still have the original installation floppies that the program came on.
They think it would be easier to reinstall later, if need be, so they
only backup the data files that they create. But floppy disks tend to
lose their data over time. Magnetic particles lose their magnetism. You
might think you have your original installation floppies, but two years
<page down> for more BACKUP
from now when your hard drive crashes and it's time to reinstall, those
floppy disks might be just about blank. Besides, what about all the con-
figuration you did, to get that program all set up just the way you like
it? Wouldn't it be easier to just back that up one time, as soon as you
get it configured to your taste, than it would be to reinstall two years
from now and try to remember exactly how you had it configured? So go
ahead and back it up once every year or so, even if you don't include it
in your monthly backup set.
You have to be really careful to stick a label onto each disk as you're
doing the backup, because the RESTORE command, which is the only way to
read backup disks, has to have the disks in the right order to be able to
put your files back together later after your hard drive has crashed. Be
really sure that you know the correct order of the backup disks. Include
the date and time on the labels too!
I keep saying "after your hard drive has crashed". Are you thinking that
I should be including the word "if" in there somewhere? Wrong. There's
no "if" about it. Your hard drive is going to crash. Some people have
<page down> for more BACKUP
weekly crashes, because they don't know what they're doing. Other hard
drive crashes are purely mechanical failure and are so bad that it means
hard drive replacement. But whichever kind of crash it is, it is going
to happen to you eventually! And if you have a nice recent complete
backup, it's not a problem (except paying for the new hard drive).
Not too many people use the DOS |nBACKUP|n command, but it's fine for a while
'til you get something better. The syntax is COMMAND SOURCE TARGET SWIT-
CHES just like most any other DOS command. So let's take those parts one
at a time. The command is |nBACKUP|n, or C:\DOS\BACKUP, or A:\BACKUP, depen-
ding on where the executable file is located.
The source is what files you want to backup. If you want to backup the
whole disk, you must perform this command from the root directory of the
disk, and the source would then be C:\*.*, which means everything in the
root directory. Later we'll get to the part of the command that tells
DOS to also include the subdirectories of the root directory.
Now the target is where you want the backup files to end up. That's just
<page down> for more BACKUP
a drive letter, like A: or B:.
Now for the harder part. Don't worry, it's not that hard. The |nBACKUP|n
command has quite a few switches from which to choose. Here they are:
/S /M /A /D:05-16-91 /T:10.02 /F /L:C:FILENAME.EXT
So, what on earth do all those things do? Well the /S switch is for
subdirectories. That's what tells DOS to backup not only the current or
specified directory, but also all of the subdirectories anywhere under
that directory.
The /M switch checks the Archive attributes for all the files, and only
backs up files that have been created or modified since the last backup
was done. You don't want to use this switch the first time you backup,
but only for incremental backups. (Incremental means just the files that
have changed since the last time.)
The /A switch tells DOS not to erase the files that are already on the
target disk, the way it usually happens, but to leave them there, and
just add the files now being backed up, to the space that is left on the
<page down> for more BACKUP
disk from the previous backup. So obviously this switch is only for in-
cremental backups also. If your last incremental backup took 5.2 disks,
then you still have 80% of that last disk empty. Well the /A switch will
allow you to fill up the empty space on that disk for this incremental
backup, instead of making you start fresh on a new disk.
The /D:05-16-91 switch tells DOS to only backup files that were last mod-
ified on or after that date. You don't want to use that switch with the
/M switch because they'd both be trying to do the same thing in different
ways. In fact, I'd never trust this switch, in case the system clock had
been wrong at some point. Because then you'd end up backing up the wrong
files all together! The /T:10.02 switch which didn't appear in DOS until
version 3.3, allows you to be even more specific, about the time. It can
tell DOS to only backup files modified at or after that time of day. Do
not forget to convert times to military format though, because if you en-
ter 3.00 then you're going to get 3 am. If you want to say 3 pm then use
15.00. Don't even think about using the /T switch without using /D also.
The /F switch tells DOS to FORMAT the disks before backing up files to
<page down> for more BACKUP
them, if they haven't already been formatted. If the FORMAT command file
is located in a directory listed in the PATH variable in the environment,
then the |nBACKUP|n command can format the disks while it's backing up. This
switch didn't exist until DOS version 3.3, so before that, we had to for-
mat a whole stack of disks before we even started backing up. Then what
would happen, is that we hadn't formatted enough disks, and we would run
out, and do you know what that used to mean to the backup process? That
would mean we would have to start over completely from the beginning af-
ter we went and formatted some more disks. Because there isn't any way
to tell the |nBACKUP|n command to pick up where we left off before we ran out
of formatted disks. Oh yes, the /F switch was welcomed by all DOS users!
Ok, last one, the /L switch. This one also didn't exist until version
3.3 of DOS. What it does is it creates a log file of what the |nBACKUP|n
command did. That way, after you've backed up your whole disk and you
have a stack of 38 floppy disks, you can tell which files are on which
floppies. Because the |nBACKUP|n command concatenates all the files into one
big file, which fills up the whole disk, so you can't tell from the dir-
ectory listing which files are where! If you leave out the path and
<page down> for more BACKUP
filename info in the /L switch, |nBACKUP|n will automatically use the default
name of |nBACKUP|n.LOG and put it in the root directory of the source disk.
In my opinion, the worst thing about the DOS |nBACKUP|n command is that there
are only two ways to do it. You can do a full backup which backs up the
whole drive, and each time after that you can do an incremental backup of
just the files that have changed since the last time you backed up.
Know what that means? That means that when it comes time to RESTORE the
files to the hard drive, you need to have that original full backup's set
of floppy disks, and you also need the disks from each and every increm-
ental backup you've done since then. If you're backing up twice every
week like you should be, then after a year you've got over a hundred sets
of backup floppies.
True, each set after the first one, might have been only one or two disks
but still, that's a tremendous amount of disks to mess with! You have to
keep them all safe and secure until such time as you do another complete
backup. After that time, but not until then, you can re-use all of the
<page down> for more BACKUP
disks from the full backup and the incremental backups. What a pain!
Some commercial backup programs have another choice in backup strategies,
though, and PC Tools, for example, calls it Differential backup. Here is
what it does:
The first full backup you do backs up every file you have, right? And
it also turns off the Archive attributes for all the files it backed up.
Now you've probably only got a few dozen files that are ever going to
change, if you don't go out and buy any more software. All these files
that are ever going to change will probably fit on one or two disks.
Well the Differential backup method backs up all the files that have the
Archive attribute set, but it doesn't turn it back off! That way, the
next time you do a Differential backup, it backs up everything that has
changed since the original full backup! That means you don't have to
keep every single set of Differential backup disks you've made!
So, on week one you do a full backup. On week two you do a Differential
<page down> for more BACKUP
backup. On week three you do another Differential backup. Now on week
four you can re-use the disks that you used for week two's backup, and
on week five you can re-use the week three backup disks! You only need
to keep your original full backup disks, and the two most recent sets of
Differentials! (The reason you want to keep last week's set as well as
this week's set is not because there are any files on last week's that
aren't on this week's, but only because in case you've made a big goof
in data entry this week, you can RESTORE last week's copy of the file,
from before you made the big goof.)
So that's just one of the reasons you want to get some other backup pro-
gram besides the DOS |nBACKUP|n command, so you can do Differential backups
instead of just incremental ones. Other reasons? Most people think that
the DOS |nBACKUP|n and RESTORE commands are not reliable. That may have been
true back in DOS version 2, but not anymore. They work perfectly well as
long as you get the syntax right. That's the hard part, for most people.
They use the wrong command and then they think it's |sRESTORE|s's fault that
they can't get their files back. But it is true that DOS's |nBACKUP|n and
RESTORE commands are not exactly friendly. There are a lot of third-
<page down> for more BACKUP
party programs that let you use menus to tell them exactly what you want
them to do. You can pick exactly which files you want backed up, etc.
One thing you really want to do whenever you're about to use the |nBACKUP|n
or RESTORE commands, is to reboot the computer without loading any |sTSR|ss
into memory, because they can seriously interfere with the operation of
these two commands. That goes for the DOS commands, or any other backup
program. And in most cases, you can only restore a backup using the RE-
STORE command from the same version of DOS that made the backup.
To get an estimate of how many disks it will take for a complete hard
drive backup, just do a CHKDSK command, and subtract "|sbytes|s available on
disk" from "|sbytes|s total disk space", divide by the capacity of the disks
you'll be using, and add two or three disks for good measure. You don't
have to worry about "|sslack space|s" the way you usually do on floppy disks,
because the |nBACKUP|n command puts all the data from all your files, into
one great big file, and fills up every single byte of disk space on each
floppy. So the only extra space that's needed, is for the control files
that tell RESTORE what files are on each disk.
<page down> for more BACKUP
One thing that |nBACKUP|n can do, that almost nothing else can do, is trans-
fer a file that's larger than the floppy disk size you're transferring it
to. |nBACKUP|n can split a file up across however many floppy disks it takes
and RESTORE can put the pieces back together into a file again. There
are also a few |sshareware|s/|spublic domain|s programs that can do it, such as
SLICE. Or, you can use a compression program like PKZIP, to make the
file small enough to fit onto one disk. But |nBACKUP|n and RESTORE are pro-
grams that you already have, so why not use them instead?
<page down> for The BASIC, BASICA, |nGWBASIC|n, and |nQBASIC|n Commands
The BASIC, BASICA, |TGWBASIC|T, and |TQBASIC|T Commands
These are the commands which run the BASIC interpreter. What does that
mean? Well BASIC is a very simple (compared to most) programming lang-
uage. Now the version of BASIC that comes with DOS does not include a
compiler. A compiler is what turns some programmer's source code into a
.COM or .EXE file. This BASIC doesn't make .COM or .EXE files; it only
makes .BAS files, and those are not executable. So you need the BASIC
interpreter to tell the computer what your source code (the .BAS file)
means. Because the computer can't understand BASIC without the inter-
preter, until it's been compiled (converted to a .COM or .EXE file). If
you want to write in BASIC and be able to compile it, there are a few
public domain and shareware compilers, but you're better off to buy Mic-
rosoft's QuickBASIC program. It's really worth it.
Now I'm just going to assume that the version you have is |nGWBASIC|n.EXE
since that's the one that comes with MS-DOS versions previous to 5.0,
which is what most people have. If you have BASIC or BASICA, just sub-
stitute that for every place I say |nGWBASIC|n.
<page down> for more GWBASIC
To run a program whose filename ends in .BAS, you just type |nGWBASIC|n fol-
lowed by the first name of that program file. For example, if you have a
file named MUSIC.BAS that you would like to run, you type |nGWBASIC|n MUSIC.
And the BASIC interpreter will load into your computer's memory, and load
that MUSIC.BAS file from your disk into memory also, and then execute the
instructions that are inside the MUSIC.BAS file. Of course, if the MUSIC
.BAS file is not in the current directory of your current drive, you'll
have to tell BASIC where to find it, as in |nGWBASIC|n C:\GW\MUSIC.
If you have IBM-DOS version 4 or earlier, then you have BASICA instead of
GW-BASIC. It's just the same thing, except for one difference. The BA-
SICA command won't run on a non-IBM computer, because IBM computers have
a part of the BASIC code stored in ROM, and the BASICA command depends on
that code for its operation. If you try to run this command on a compu-
ter that isn't a true-blue IBM, the code will just sit there all day long
looking for that piece of ROM that has the rest of the BASIC code in it,
and you can't do a thing about it except reboot. So that's why people
with clones (computers that are compatible with IBM but are not manufac-
tured by IBM) are not supposed to be using PC-DOS. Because PC-DOS does
<page down> for more GWBASIC
not have a |nGWBASIC|n command, and the BASICA command won't run on a clone.
If you run |nGWBASIC|n without a filename, it will just load and sit there
showing you its |nprompt|n, and waiting for you to tell it what to do. (The
BASIC |nprompt|n is just _, an underline, which is usually preceded by an OK
message.) If you want to get back to DOS just type SYSTEM and hit the
<Enter> key. Otherwise, go get yourself a nice BASIC book and check it
out. It really is a lot easier than other programming languages.
The name BASIC, by the way, stands for Beginners' All-purpose Symbolic
Instruction Code.
If you have a special proprietary version of MS-DOS, like from the Kaypro
company or the COMPAQ company or the Zenith company, you might have a
command named BASIC instead of |nGWBASIC|n. But it's just the same thing,
only optimized to run best on your specific brand of computer.
If you have DOS version 5, you have the |nQBASIC|n command instead of BASICA
or |nGWBASIC|n. It's a very greatly improved version! But for the earliest
<page down> for more GWBASIC
release of IBM-DOS 5, the same rules apply, about trying to run |nQBASIC|n on
a non-IBM computer. It won't work. But about two months after the init-
ial release, IBM finally, after all these years, released a fixed ver-
sion that allows |nQBASIC|n (and therefore, |sEDIT|s) to work on clones, just
like MS-DOS has always been able to do!
To run a |nQBASIC|n program straight from the command line, you type a com-
mand like this: |nQBASIC|n /RUN C:\DOS\PROGRAM.BAS. If the last instruction
in the PROGRAM.BAS file is SYSTEM, then when the program is done, it will
return to DOS instead of just sitting there in the |nQBASIC|n environment
waiting for you to type SYSTEM.
If you have some old BASIC programs from a previous DOS version, the REM-
LINE.BAS program that comes with DOS 5.0 will help you convert them to
the format that |nQBASIC|n uses. But first you have to use your old version
of the BASIC interpreter to save the program in plain ASCII format in-
stead of the compressed BASIC format.
<page down> for The |nCHKDSK|n Command
The |TCHKDSK|T Command
This is a very useful command that performs many different functions.
The main thing it is supposed to do is CHecK the directory structure of
your DiSK. There are lots of things that can go wrong when the read/
write heads are writing to a disk. Any sort of disturbance can cause
the heads to not write what they were supposed to write, and |nCHKDSK|n can
find what problems may have been caused, and can also correct some of
them.
However, |nCHKDSK|n will only make corrections if the /F switch was specified
on the command line. If the /F switch was not given, and |nCHKDSK|n finds
any errors, it will say something like, "F parameter not specified, cor-
rections will not be written to disk". |nCHKDSK|n will continue to act like
it is making corrections, however, just to show you what corrections it
would have made if the /F switch had been specified. So if you like the
corrections, you can re-run the |nCHKDSK|n command with the /F switch and it
will actually write the corrections to the disk. Do not ever use the /F
switch while any |sTSR|ss are in memory!
<page down> for more CHKDSK
The most common error that |nCHKDSK|n finds is something like "4 lost chains
in 6 |scluster|ss". What that means is that there is some data on the disk
that has space allocated to it in the FAT, but that has no entries in the
directory. If you specify the /F switch, |nCHKDSK|n will convert those lost
chains to files, and give the files names like FILE0000.CHK and put them
into the root directory of the disk. Now what do you do with them?
Well, first look at them with the TYPE command or some other file brow-
ser. If they are nothing but strange symbols, then they must have been
.COM or .EXE files, and there is no way you can recover them. Because it
is highly unlikely that the files are complete, and who knows what might
happen if you try to run a command file that is not complete. Just del-
ete those files.
If there is some recognizable text inside though, you should be able to
tell what application the lost chain was from. Just load it into that
application, and do your best to put the file back to the way it used to
be. It's usually better than losing the whole file.
<page down> for more CHKDSK
Most often, though, these FILE0000.CHK files that |nCHKDSK|n makes are not
anything important at all. They're usually pieces of temp files that
some application was using, which would have been deleted by that app if
the app had been properly exited, but maybe your machine locked up and
you had to reboot, so the app didn't get a chance to delete its temp
files. Well if it happened at a moment when the app had temp file space
allocated in the FAT, but it didn't have the temp file's directory entry
updated, then the temp files will end up as lost chains. Deleting them
is no problem because once the app lost its place in the temp file, it
can't figure out what to do with it anyway, even if it was something im-
portant.
Well as long as these lost |scluster|ss are sitting on your disk, they're
just taking up disk space for no reason. So you want to run the |nCHKDSK|n
command every week or so, to free up any space that might be in use by
these silly things.
Another error message that |nCHKDSK|n comes up with pretty often is "FILE1 is
cross-linked on cluster ##, FILE2 is cross-linked on cluster ##". This
<page down> for more CHKDSK
means that both FILE1's and FILE2's FAT entries say that the two files
are using the same cluster of disk space. This is a FAT error that CHK-
DSK can't do anything about. You have to try to fix it yourself. You
must not ever try to run an executable file that has been cross-linked!
Just delete it. But if one or both of the files are non-executable,
there is hope for recovery. Just COPY the files to a different disk or
directory and delete them both from the original location. Now load the
files into whatever application created them and see how much data you
can save. One of the files will contain a cluster from the other file,
and also one or both of them may have been truncated (cut off) at the
point where the cross-linkage had occurred. But it's better than losing
both files altogether. Of course if they were both executable files then
it's a total loss. That's what |sBACKUP|ss are for.
So, what else is the |nCHKDSK|n command good for? Well, it gives you a real
nice summary of what's on your disk, as well as how much free memory you
have. It can also give you a list of every file on the disk, if you use
the /V (verbose) switch. And that will include all the Hidden files too.
If you pipe the output of |nCHKDSK|n /V to the FIND command, you can find the
<page down> for more CHKDSK
location of any file on your disk:
|nCHKDSK|n C:\*.* /V || FIND ".BAT"
would show you the full filespec for every .BAT file on the disk. But
remember, the FIND command is case-sensitive, and filenames are always
stored in all caps, so FIND ".bat" would not work at all.
Another thing the |nCHKDSK|n command can do is tell you whether you have any
|tfragmented|t files. What does that mean? Well, DOS stores files on a disk
a cluster at a time. A cluster, depending on the version of DOS the disk
was formatted with, and also the size of the disk, can be anywhere from
512 to 16384 bytes. Most hard disks have 2048-byte |scluster|ss. Well when
DOS is writing a file to disk, it puts down one |scluster|s's worth of data
into the first available cluster on the disk, then it puts the second
cluster of the file into the second available cluster on the disk, then
it puts the third cluster of the file into the third available cluster on
the disk, etc. These |scluster|ss aren't necessarily next to each other on
the disk, and if they're not, then the file is said to be |nfragmented|n.
Your hard drive will appear to work faster if all the pieces of a file
are right next to each other, or in contiguous |scluster|ss. There are lots
<page down> for more CHKDSK
of disk defragmenters on the market, and it's a very good idea to get one
and use it weekly.
If you can't yet afford to buy a disk defragmenter (often called a disk
|toptimizer|t) and you can't find a shareware one, another solution to frag-
mentation is to BACKUP the disk, FORMAT it, and RESTORE the files. This
is because any time you backup or COPY a file to a blank disk, all the
pieces of the file are placed into contiguous |scluster|ss. Then when you
format that first disk, all the |scluster|ss become available again so when
you restore the files, they also stay in contiguous |scluster|ss. It's only
after you have deleted some file from the disk, that a space opens up in
the middle of the disk space so the next file that's written to the disk,
if it's longer than the file that got deleted, may become fragmented.
In order to make the |nCHKDSK|n command tell you about fragmentation on an
entire disk, you have to use the command on each directory separately.
For example, |nCHKDSK|n C:\*.* and |nCHKDSK|n C:\DOS\*.* and |nCHKDSK|n C:\UTIL\*.*,
et cetera.
<page down> for more CHKDSK
Please see the end of the Cache chapter for more important info about the
|nCHKDSK|n command, and also the FORMAT chapter for information about what
|nCHKDSK|n means when it reports |sbad sector|ss.
<page down> for The |nCOMP|n and |nFC|n Commands
The |TCOMP|T and |TFC|T Commands
These commands are used to COMPare two Files. The syntax is simple:
|nCOMP|n D:\DIR\FILE1.EXT D:\DIR\FILE2.EXT
|nFC|n D:\DIR\FILE1.EXT D:\DIR\FILE2.EXT
Where D: is the drive letter for each file, and |nDIR|n is the directory for
each file, and FILE#.EXT are the names and extensions of the files that
you want to compare to each other.
The |nCOMP|n command compares each byte of the first file, with each byte of
the second file, in order, and if there are ten mismatches, the command
will abort itself. If there are less than ten differences, they will be
displayed on the screen. The format of the display is not very friendly,
however. It will say something like "Compare error at offset 3 File 1 =
44 File 2 = 64". That means that the fourth byte of the first file is a
capital D, and the fourth byte of the second file is a lowercase d. Why
does it mean that? Well the offset means how many bytes past the first
one, so offset 3 = byte 4. And the 44 and 64 are the hexadecimal values
for the ASCII characters D and d. If your version of DOS has the |nFC|n com-
<page down> for more COMP and FC
mand, you will usually want to use it instead of the |nCOMP|n command. It's
much more friendly. But if you're in a hurry, |nCOMP|n is much faster.
If the files have different byte sizes, the |nCOMP|n command won't even try
to compare them.
Some computer manufacturers that put out their own slightly different
versions of DOS include a |nCOMP|n command that's slightly different than the
way I've described it. My description is for regular PC-DOS or MS-DOS
so yours could be a bit different, but it should have the same usage and
syntax.
One way in which this command is really useful despite its unfriendliness
is for copying really important files. It is possible (although rare!)
for a computer to make a mistake, so you can just use the |nCOMP|n command on
the source and target files, after a COPY command, to be absolutely sure
that the copy was made perfectly. Any time you are tempted to use the /V
switch with the COPY command, you're better off leaving out the /V and
using |nCOMP|n or |nFC|n after the copy is made, instead. (See VERIFY.)
<page down> for more COMP and FC
If you're using a disk cache, neither of these commands will do you any
good, since what will actually get compared is the destination copy and
the copy in the cache, rather than the source copy on the disk.
You can use wildcards with these commands, too. If you want to compare
every .BAT file on drive C: with each file of the same name on drive A:,
|nCOMP|n C:*.BAT A:\*.* will do it. Since the second filename was specified
with *.* the command will just look for files with the same names as the
files on the source side.
MS-DOS version 5 brings good news to the |nCOMP|n command. It has some swit-
ches that make it a lot friendlier. The /D switch will display the dif-
ferences in decimal ASCII code instead of in hex numbers. The /A switch
will actually show the characters instead of codes. /L will show the
line number of the mismatch instead of the byte offset. And the /N=#
switch will compare the first # lines of the files even if the byte size
of the files do not match. Finally, the /C switch makes a non-case-sen-
sitive comparison. In other words, D and d will not be regarded as a
mismatch.
<page down> for more COMP and FC
The output of the |nFC|n command is the last line that matches in both files
right before some lines that are different, followed by the lines that
don't match, and finally the first line that matches again. If there is
another mismatch between the files, then you'll see the corresponding
sequence of lines for that difference, and then the next difference if
there is another one, etc. If there aren't any differences, |nFC|n will tell
you that instead.
There are lots of switches with this command, that can make it do slight-
ly different things. /A /B /C /L /LB# /N /T /W and /# are the possible
switches. The /B switch causes a binary comparison rather than an ASCII
comparison, and if you use the /B switch then you don't want to use any
of the other switches with it. If you are comparing files that have the
extension .BIN, .COM, .EXE, .LIB, .OBJ, or .SYS, then this is the default
so you don't need to specify the switch. A binary comparison means that
the output will be displayed like 00000015: B8 0F. That's the offset ad-
dress of the mismatch (that means how many bytes past the first byte in
the file) and the hexadecimal codes for the byte in the first file, and
the hex code for the byte in the second file that didn't match it. The
<page down> for more COMP and FC
rest of the switches are for ASCII comparisons, which means the lines
that don't match are displayed in normal text form.
The /A switch gives an abbreviated output. That means that if there is
more than one line in a row that don't match between the two files, all
the mismatched lines won't be displayed. Just the last matching line
before the mismatch, then a ... symbol to show that other lines exist,
then the first matching line after the mismatch. Of course if there's
only one line that doesn't match, that line will be displayed, since it
takes up as much room on your screen to show the line as it takes to show
the ... line that just stands for other lines.
The /C switch tells |nFC|n to ignore the case of the letters, so that HELLO
will not be regarded as a mismatch with hello.
/L is the default for ASCII files, so it's only used when you want to
make an ASCII comparison on a file that has the extension of .BIN, .COM,
.EXE, .LIB, .OBJ, or .SYS.
<page down> for more COMP and FC
The /LB# switch tells DOS how many lines in a row are allowed to be dif-
ferent, without causing the |nFC|n command to abort. The default is 100.
The /N switch makes |nFC|n display the line number along with each line. The
/T switch causes |nFC|n to not expand tabs to spaces. The /W switch causes
|nFC|n to treat a bunch of consecutive spaces like just one space. The /#
switch tells |nFC|n how many lines after a mismatch have to match before |nFC|n
should consider that the files are matching again. The default is 2. I
can't think of any reason why a body would really want to worry about
that switch. In fact most of the time you'll want to use no switches, or
maybe the /C or /N switch. You can pretty much ignore the rest. Except
if you want to delete the |nCOMP|n command because you like |nFC|n better, in
that case you would be wanting to use the /B switch whenever you're just
verifying a COPY command, because the /B will make it work much faster,
and since the target file should be identical to the source, you won't be
needing the nice friendly output that you'd get from not using the /B
switch, because the only output you should be getting is "No differences
encountered".
<page down> for The |nDEBUG|n Command
The |TDEBUG|T Command
The only thing I really have to say to a beginner about this command, is
leave it alone. If you don't know how to use it, then you don't know
enough about computers to have any business messing with it. I don't
mean to sound harsh or anything but this is a highly powerful (meaning
dangerous, in the wrong hands) command. One slip of a finger and you
could easily trash every speck of data on your entire hard disk. You
can even damage the hardware itself with this command, believe it or not!
Don't use it unless you know what you're doing!
That doesn't mean you should necessarily delete it from your hard disk,
however. There are some things you can safely use it for. PC Magazine
and several other computer-related magazines publish little scripts that
you can type up and then use |nDEBUG|n to assemble them into .COM files.
This gives you a way to get some little utilities such as CAPSLOCK.COM
without buying or downloading anything. You can sit right in your living
room and create utilities that can perform all sorts of functions. If it
weren't for |nDEBUG|n, you couldn't do that. And it's really quite safe as
<page down> for more DEBUG
long as you proofread each line you type in, before you hit the <Enter>
key, and just carefully follow the instructions in the magazine.
If you ever accidentally execute this command, you will get a |nprompt|n that
just looks like this:
-
That's it. That's the |nDEBUG|n |nprompt|n. Just type a Q (for Quit) and hit
the <Enter> key, and you'll be right back in DOS.
Anyway, the main purpose of this command is to examine and modify data
either in memory, or on disk. It's called |nDEBUG|n because its main purpose
is supposed to be for finding the bugs in programs that a programmer is
in the process of writing. But hardly anybody ever uses it for that. In
fact, hardly even any programmers use it for that.
<page down> for The |nDISKCOPY|n and |nDISKCOMP|n Commands
The |TDISKCOPY|T and |TDISKCOMP|T Commands
The |nDISKCOPY|n command will make an exact duplicate of a floppy disk, and
|nDISKCOMP|n will ensure that it worked perfectly. |nDISKCOPY|n copies every
single byte of data on the disk, including bad sector marks and the
formatting codes. For this reason you don't have to format the target
disk first, but you should anyway because if you don't, then you won't
know whether the disk has any |sbad sector|ss, and you could end up copying
good data to a bad sector. If the target disk does have any |sbad sector|ss,
you must not use it for a |nDISKCOPY|n purpose. Because although the FORMAT
command will mark out the |sbad sector|ss, the |nDISKCOPY|n command will ignore
that, and copy the data to the target disk in the exact same way the data
was sitting on the source disk.
If the target disk has been used before, it will be completely erased!
Another problem with this command is that it can only be used to copy one
disk to another disk of the exact same size and capacity. A whole lot of
beginners get fooled by that. Since |nDISKCOPY|n makes a |ssector|s-by-|ssector|s
<page down> for more DISKCOPY and DISKCOMP
mirror image of the source disk, the target disk has to have the exact
same number of |ssector|ss as the source disk. You can't |nDISKCOPY|n from a
double-density to a high-density disk, or from a 3.5" disk to a 5.25"
disk, or anything like that, or to or from a hard disk.
Now, some good points about this command: For one, since it copies every
byte on the source disk, it copies any System and/or Hidden files, which
are otherwise impossible to copy without changing those attributes first.
Second, this command will copy files from the source disk to the target
disk in the same logical drives, with the command |nDISKCOPY|n A: A: or the
|nDISKCOPY|n B: B: command. So you can copy files between disks of the same
size even if you have both sizes of floppy drives, which is not possible
with the COPY or XCOPY commands. DOS will tell you when to switch disks,
so you just need to be careful to remember which disk is which. It is a
good idea to write-protect the source disk, so that even if you forget
and put the source disk in when DOS asks for the target disk, the source
disk will not get ruined.
<page down> for more DISKCOPY and DISKCOMP
Notice that |nDISKCOMP|n will say that two disks are totally different if the
one is not a |nDISKCOPY|n of the other. Even if they have the exact same
files on them. Because for example, if the files on the source disk were
fragmented, and the COPY or XCOPY command was used to copy all the files
to another disk, the target disk will be totally unfragmented. And DISK-
|nCOMP|n compares |ssector|s-by-|ssector|s, not file-by-file. So the two disks won't
compare at all, even though each file on the target disk might be an ex-
act duplicate of its twin on the source disk.
<page down> for The |nDOSKEY|n Command
The |TDOSKEY|T Command
This command is new to DOS version 5.0 and you're going to love it! You
know the editing keys that DOS has always used before? Well they are
helpful up to a point, but they're nothing compared to DOSKEY!
It's a TSR, but it only takes 4.5K of RAM even if you enlarge its inter-
nal buffer size to 1024 bytes, and it's just about the most useful 4.5K
you ever spent! Of course you can LOADHIGH it if you have a 386 with
some extended memory.
What does it do? Well, it's very much like 4DOS's command line editing
and aliasing, and it's very much like the third-party History and Alias
and CED utilities. There are a lot of little utilities that have been
written over the years to perform these functions, but now DOS has its
own, and since it comes with DOS it's guaranteed to work with DOS.
It remembers all the commands you've issued for a while, and you can re-
call them and edit and re-issue them, instead of just retyping some fifty
<page down> for more DOSKEY
character long command that you just issued five minutes ago. You can
use the <Home> and <End> keys, <Insert> and <Delete> characters, change
whatever you want to change in a previous command, or just re-enter it
the way it was.
Another benefit of |nDOSKEY|n is that you can type more than one command on a
line, and execute them all at once, instead of typing one, waiting for it
to complete, typing the next, waiting, etc., whenever you know exactly
what commands you're going to execute next. For example, if you have a
large file that you want to move from the C: drive to the B: drive, in-
stead of typing COPY C:FILE.EXT B: and then waiting for that to finish,
then typing DEL C:FILE.EXT, you can instead type COPY C:FILE.EXT B:
<Ctrl-T> IF EXIST B:FILE.EXT DEL C:FILE.EXT and hit <Enter>, and it will
be done automatically. (The reason for the IF EXIST command is in case
the COPY operation fails, then the source file won't get automatically
deleted, but if the COPY is successful, then it will.) Now whenever you
type <Ctrl-T> to separate the commands that you are typing all on one
command line, a symbol will appear on the command line. That's normal;
that's what it's supposed to do. Of course with DOS we've always been
<page down> for more DOSKEY
able to type the next command while the last command is still executing,
but only up to fifteen characters. On the sixteenth character the key-
board buffer is full and the computer just beeps. With |nDOSKEY|n you can
enter successive commands up to 128 characters instead of only fifteen.
Well as soon as you execute the |nDOSKEY|n command the first time after each
reboot, that loads it into memory and then it starts remembering every
command that you enter. When its |ninternal|n buffer gets full, it forgets
the oldest command so that there is room for the next command you type.
It always remembers the most recent commands, however many can fit in the
size of buffer you have chosen to use.
The <Up arrow> key will show you the previous commands that you have en-
tered, one at a time, starting with the most recent one. The <Down ar-
row> key will show you the command that you entered right after you en-
tered the one you're looking at. Of course if you're looking at the last
command you entered, the <Down arrow> key will show your |ncurrent|n command
line, which is blank. Once you find a command that you would like to re-
issue, just hit the <Enter> key, or edit it first by using the <Home>,
<page down> for more DOSKEY
<End>, <Insert>, <Delete>, and <Arrow> keys and then hit <Enter>.
The <F7> key will show you all the commands that |nDOSKEY|n has stored in its
buffer, in a numbered list. To choose a command from the list, hit <F9>
and |nDOSKEY|n will ask you which numbered command you want to execute. Type
its number and off you go!
My favorite is the <F8> key. If you want to execute the last command
that started with "DI", but it was quite a while ago so you don't want to
go looking for it with the <Up arrow> key, just type DI and hit <F8> and
it will show you the last command you entered that started with "DI" and
if that's not the right one, hit <F8> again and it will show you the last
"DI" command before that. When you find the one you want, hit <Enter>.
The <Page Up> key shows you the very oldest command that is still in DOS-
KEY's buffer, and <Page Down> shows you the most recent command.
Now here are all the keys that you can use to edit previous commands be-
fore you re-enter them, or to edit the command you're presently typing.
<page down> for more DOSKEY
First of all, the regular DOS editing keys we've always used still work
for the |ncurrent|n command. (They work a bit different though, than without
|nDOSKEY|n installed, especially if you use the /INSERT switch, so be careful
until you adjust.) But |nDOSKEY|n adds all of the following:
The <Home> key takes the cursor to the leftmost character in the command.
<End> takes you to the space after the rightmost character. The <Left>
and <Right> arrows move the cursor one space in the indicated direction.
<Ctrl-Left> and <Ctrl-Right> move the cursor one word in the indicated
direction.
The <Backspace> key deletes the character to the left of the cursor. The
<Delete> key deletes the character that the cursor is on. <Ctrl-End>
deletes the character that the cursor is on, as well as all the rest of
the characters to the end of the line. <Ctrl-Home> deletes all the char-
acters to the left of the cursor, making the character that the cursor is
on become the first character of the command.
The <Insert> key toggles insert mode on and off. If insert mode is on,
<page down> for more DOSKEY
any character you type will cause the character the cursor is on, and all
the characters to the right of it, to move to the right to make room for
the characters that you type. If insert mode is off, then whatever you
type will replace the character that the cursor is on. If you have DOS-
KEY set up so that insert mode is the default, then every time you hit
the <Enter> key to carry out a command, it goes back to insert mode even
if you were in replace mode when you finished editing that command. The
same thing goes if your default is replace mode; hitting <Enter> takes
you back into your default mode even if you had used the <Insert> key to
temporarily change modes.
The <Esc> key erases the entire line that you're working on.
You can even use |nDOSKEY|n to create an actual batch file on disk, if you
want to execute the batch file as you write it. Just type the <Alt-F7>
keystroke combination, which erases the |nDOSKEY|n buffer, then execute the
commands that you want the batch file to contain, then type this:
|nDOSKEY|n /HISTORY > NAME.BAT
where NAME.BAT is the batch file that you want to create. The |nDOSKEY|n
<page down> for more DOSKEY
/HISTORY switch displays a list of all the commands that are currently in
the buffer, and since you cleared the buffer before you started, "all the
commands" means just those commands you wanted in the batch file. Then
the > means that DOS should use redirection to send that list to a file
named NAME.BAT instead of sending it to the screen as it normally would.
The /HISTORY switch can also be abbreviated as /H.
Not only that, but you can also create what DOS calls "|smacros|s" with DOS-
KEY. They're not really macros though. That term generally means using
one keystroke in the place of a whole bunch of keystrokes. But macros is
what DOS called these |nDOSKEY|n things, so we'll have to live with it. DOS-
KEY's macros are really more like batch files than anything else. Just
really fast batch files though, since macros are stored as part of DOS-
KEY's |ninternal|n buffer so they're always in memory and never need to be
read off the disk except the first time you create the macros during each
session. Don't worry about the fact that the <Alt-F7> combination clears
DOSKEY's buffer. It doesn't wipe out the macros, just the |nmemory|n of the
most recent commands you've entered at the command line.
<page down> for more DOSKEY
Another way in which |nDOSKEY|n macros are better than batch files is that
the files in which they are stored on disk don't take up any disk space.
I mean if you put the |nDOSKEY|n macro-creating commands in your AUTOEXEC.BAT
file, that won't take up any more disk space than the AUTOEXEC.BAT file
without macro commands did, unless you put in so many macro commands that
the AUTOEXEC.BAT file gets larger than one cluster in size, because of
"|sslack space|s". Any file, no matter how small, takes up a whole cluster
of disk space, so an AUTOEXEC.BAT with a bunch of |nDOSKEY|n macros that is
1987 bytes long, doesn't take any more disk space than an AUTOEXEC.BAT
file with no |nDOSKEY|n macros that is 38 bytes long. For example, you could
put fifteen |nDOSKEY|n macros in your AUTOEXEC.BAT file and delete fifteen of
the batch files you used to use, and that would free up fifteen |scluster|ss
which is 30K of disk space on most hard drives.
There are a few other ways in which a |nDOSKEY|n macro is different from a
batch file. Since the macros are stored in memory instead of on disk,
you don't have to have access to a disk-based .BAT file in order to exec-
ute a macro. It's just like the macro were an internal DOS command.
<page down> for more DOSKEY
A macro can only have a total length of 127 characters because the whole
macro goes on one line and DOS commands can only have 128 characters in-
cluding the carriage return (the <Enter> key), whereas there is no limit
to the length of a batch file.
You can terminate a batch file by pressing <Ctrl-C> or <Ctrl-Break>, but
pressing one of those combinations while a macro is executing will only
terminate the command that's running right now. The next command in the
macro, and all the ones following it, will still get executed, just as if
you had used <Ctrl-Break> in a batch file and answered "N" when it asked
"Terminate batch job?"
In |nDOSKEY|n macros you use $1 through $9 instead of the usual %1 through %9
for replaceable parameters. You can also use the replaceable parameter
$* in macros, and what it means is "all parts of the command tail togeth-
er", even if it's more than nine parameters, instead of just one "word"
at a time as $1 through $9 mean. For example, if you had a macro named
HELLO and you entered the command HELLO ABC DEF GHI at the prompt, $1 is
ABC, $2 would be DEF, and $3 gets GHI. But $* would be ABC DEF GHI.
<page down> for more DOSKEY
The redirection characters that can be used in |nDOSKEY|n macros are quite
different from the normal ones. $L (which stands for Less than) is used
in place of <, $G (Greater than) for >, $G$G for >>, and $B (who knows
what that's supposed to stand for, but it's the same symbol that's used
for || in the PROMPT command, too) for ||.
You cannot use the GOTO or SHIFT commands or turn ECHO off in a |nDOSKEY|n
macro, or even use the @ symbol to suppress the display of a command.
You cannot in any way execute a second macro from within one macro, as
you can do using the CALL command for batch files. You can't run a macro
from within a batch file either, but that's not a big problem since the
purpose of a macro is to save keystrokes. You don't need to save key-
strokes inside a batch file, since you only need to create it once.
You can't access an environment variable from within a macro as you can
from within a batch file, with a construction such as %PATH%.
To create one of these |nDOSKEY|n macros, for example if you wanted to create
a macro that would clear the screen and give you a directory listing of
<page down> for more DOSKEY
the current directory with the /W and /P switches, you'd just enter this
command: |nDOSKEY|n MYDIR=CLS $T DIR /W /P and from that point on, until you
reboot the computer, every time you enter the command MYDIR, the commands
CLS and DIR /W /P will be executed for you. Any macros that you want to
have active every time you start your computer should have their macro-
creating commands in your AUTOEXEC.BAT file.
To create a |nDOSKEY|n macro that uses replaceable parameters, it's done just
the same way as it's done in a batch file, but $1 through $9 are used in-
stead of %1 through %9. For example,
|nDOSKEY|n DIRTYPE=DIR $1 $T PAUSE $T TYPE $1 $B MORE
Now every time you execute the command DIRTYPE FILENAME, the following
commands will be executed:
DIR FILENAME
PAUSE
TYPE FILENAME || MORE
Because $1 means the first "word" that's typed on the command line after
the name of the macro, $T is what's used to separate multiple commands,
and $B in macros is the || symbol.
<page down> for more DOSKEY
You can also make a macro that has the same name as a regular DOS com-
mand. For example, if you had a macro that cleared the screen and then
did a DIR command, you could name it DIR if you wanted to. DOS would
execute the macro instead of the internal DOS DIR command whenever you
enter DIR as a command. But if you need to execute the regular DIR com-
mand instead of your macro, you can just type a <Space> between the DOS
prompt and the DIR command, and that way DOS would not recognize it as a
macro, but would recognize it as an internal command or executable file.
After you create some |nDOSKEY|n macros and decide you want to use them per-
manently, you can just type |nDOSKEY|n /MACROS > NAME.BAT to create a file
called NAME.BAT which will contain all the macros that you currently have
stored in memory. But wait, it's not a batch file yet. If you edit that
file and put the |nDOSKEY|n command and a <Space> in front of each line, then
you will have created a batch file that you can run each time you boot
your computer, which will load all of those macros into memory. This is
similar to the way you use |nDOSKEY|n /HISTORY > NAME.BAT to create a batch
file as described above, but that makes a file out of all the commands
you have typed at the DOS prompt. The /MACROS switch calls up a list of
<page down> for more DOSKEY
all the macros you have created since you last |sreboot|sed your computer.
It can also be abbreviated as /M.
If your |nDOSKEY|n |ninternal|n buffer gets too full to store any more macros,
you can delete one by setting it equal to nothing, as in |nDOSKEY|n DIRTYPE=
but that won't give the buffer space back to the part of the buffer that
stores every command you type. It will only free it up for more macros.
You can delete all the macros from the |ncurrent|n |nDOSKEY|n buffer by typing
the <Alt-F10> keystroke combination.
Since the dollar sign ($) is used in |nDOSKEY|n macros to represent a lot of
different things, if you want to use a dollar sign that does not have a
special meaning to |nDOSKEY|n, you use a double dollar sign. For example, if
you have a file named FILE$ and you want to have a macro that backs up
that file to a different disk, then when you enter the command which cre-
ates that macro, the filename will have to be entered as FILE$$, like
this: |nDOSKEY|n BAK=COPY FILE$$ B:. |nDOSKEY|n will see the double dollar sign
in that macro definition and know that it's not supposed to do anything
special with that particular dollar sign, even though most dollar signs
<page down> for more DOSKEY
are supposed to be interpreted in some way by the |nDOSKEY|n command.
When you first load |nDOSKEY|n into memory, usually in your AUTOEXEC.BAT
file, if you want its |ninternal|n buffer to be anything other than 512 bytes
then you have to tell it so, since 512 is the default. You can set the
size anywhere from 256 bytes on up. |nDOSKEY|n /BUFSIZE=#### will do it.
You can also tell |nDOSKEY|n whether you want it to default to insert mode
or replace (overstrike) mode. |nDOSKEY|n /INSERT or |nDOSKEY|n /OVERSTRIKE will
do that. The default is overstrike so you only need to use that if you
(or your AUTOEXEC.BAT file) had previously used the command |nDOSKEY|n /IN-
SERT since the last time you |sreboot|sed.
The |nDOSKEY|n command also has a switch called /REINSTALL but I can't imag-
ine why anyone would want to use it. It loads another copy of |nDOSKEY|n
into memory, taking up extra memory. It also clears the buffer, but you
can do that with the <Alt-F7> and <Alt-F10> combinations, so why would
you want to load a new copy of |nDOSKEY|n into |smemory|s? I don't know. But
if you want to, you can, by entering |nDOSKEY|n /REINSTALL.
<page down> for more DOSKEY
Well there was a lot of information in that section! How about a review?
Entering more than one command at a time:
<Ctrl-T> separates commands on the command line
Finding a command to edit:
<Up arrow> displays previous command
<Down arrow> displays next command
<Enter> executes command
<F7> numbered list of all commands in buffer
<F8> type TEXT, then it finds last command that began with TEXT
<F9> executes a command from the numbered list displayed by <F7>
<Page Up> earliest command in buffer
<Page Down> most recent command
Editing commands:
<page down> for more DOSKEY
<Home> moves cursor to first character of command
<End> moves cursor to end of command
<Left arrow> moves cursor to left
<Right arrow> moves cursor to right
<Ctrl-Left> moves cursor to beginning of last word
<Ctrl-Right> moves cursor to beginning of next word
<Backspace> deletes character left of cursor
<Delete> deletes character under cursor
<Ctrl-Home> deletes all characters left of cursor
<Ctrl-End> deletes all characters right of cursor
<Insert> toggles between insert and replace (overstrike) modes
<Escape> erases the |ncurrent|n command line
Naming macro with same name as a DOS command:
<Space>NAME allows execution of command with same NAME as a macro
Erasing the |nDOSKEY|n buffer:
<page down> for more DOSKEY
<Alt-F7> erases the command buffer
<Alt-F10> erases the macro buffer
Writing macro definitions:
$1 -- $9 replaceable parameters; same as %1 -- %9 in batch files
$* a replaceable parameter that means the entire command tail
$L for redirection; the < symbol
$G for redirection; the > symbol
$G$G for redirection; the >> symbol
$B for redirection; the || symbol
$T to separate commands
$$ to represent a dollar sign inside a macro
<page down> for more DOSKEY
Switches for the |nDOSKEY|n command:
/BUFSIZE=#### size of |nDOSKEY|n buffer for commands and macros; default 512
/HISTORY (/H) display of all commands in buffer
/INSERT makes insert mode the default
/MACROS (/M) display of all macros in buffer
/OVERSTRIKE makes replace mode the default again if /INSERT was used
/REINSTALL loads a new copy of |nDOSKEY|n into memory, clears buffer
Here is an excerpt from my AUTOEXEC.BAT file which shows all the |nDOSKEY|n
parts. Notice that you must load the |nDOSKEY|n TSR into memory before you
begin issuing any macro-making commands:
C:\DOS\DOSKEY /BUFSIZE=1024 /INSERT
C:\DOS\DOSKEY PCS=C:\PCT\PCSHELL
C:\DOS\DOSKEY THES=CD C:\AW\THES $t THESAUR $t CD\
C:\DOS\DOSKEY 4=CD C:\UTIL $t 4DOS $t CD\
C:\DOS\DOSKEY HLP=C:\SIMPLY\HLPURSLF C:\SIMPLY\SIMPLY1
<page down> for The |nDOSSHELL|n Command
The |TDOSSHELL|T Command
The first thing I have to say about the DOS Shell is that I'm sorry. I
really am. I just can't do this. I wanted to work with the Shell for
a while and learn how to deal with it, so that I could do a good job of
writing about it. But I just can't do it. I hate Shells. I tried, I
really did. But I can't. Forgive me? I'll tell you everything I know
about it, though.
First, what is the DOS Shell? Well it's a menu-driven mouse-supporting
interface that "protects" you from having to deal with DOS. (Now you can
see why I hate it, because I love DOS and don't want to be protected from
it.) It shows you a menu of things that you can do, and you use the ar-
row keys or the mouse to choose the thing you want to do, and it does it
for you. You don't have to know any DOS commands or anything to be able
to use it. Of course you do have to know about DOS in order to be able
to configure it to your personal taste, and to add your own menu choices
to it and stuff.
<page down> for more DOSSHELL
When you enter the |nDOSSHELL|n command, after a minute, you will see the
Shell. To get the menus, just hit the <Alt> key and the menu bar will
light up, you just type the letter that stands for the menu you want to
see. Then you type the letter that's highlighted in the option you want
to choose from that menu. Or you can use the <Left> and <Right> arrows
to move to another menu, or you can use the <Esc> key to get out of the
menus altogether. To get help, just hit the <F1> key.
The version 4 DOS Shell requires that you use the APPEND command so that
the Shell will be able to find its companion files. But the APPEND com-
mand is not a good thing to use. Besides that, it's a TSR so it's really
a waste of memory. There's a way to get around the need for the APPEND
command though. Just edit the |nDOSSHELL|n.BAT file, add the lines C|1: and CD
C:\DOS at the beginning, and |sCD|s\ at the end. This will change to the DOS
directory before running the Shell, so that all the companion files will
be in the current directory and the Shell will be able to find them even
without the APPEND command, so take APPEND out of your AUTOEXEC.BAT file.
While the "shell" in |nDOSSHELL|n has nothing to do with the SHELL command or
<page down> for more DOSSHELL
any other computer-related meaning of the word "shell", it is tied in to
the concept of Shelling Out in certain ways. Go read that chapter if you
have ever had a bunch of files named 10370F37 or anything like that, or
if you've ever found that you had more than one copy of COMMAND.COM in
memory at the same time and didn't know why, or if the Shell is taking up
too much memory for you to run your programs.
If you want to be able to print files from within the DOS Shell, you have
to first install the PRINT TSR from the command line. (Not, and I repeat
not, from within the Shell. Exit the Shell completely first.) Just type
PRINT <Enter>, and it will ask you what port your printer is attached to.
If it's on LPT1 then hit <Enter> again, and otherwise tell it the correct
port and hit <Enter>. When you go back into the Shell, your Print option
on the Files menu will work. If you really want to be able to print from
within the Shell all the time, and you have the memory to spare, then you
can put PRINT /D:LPT1 (or PRINT /D:COM1 if your printer is attached to
that port instead) into your AUTOEXEC.BAT. Then the print option in the
Shell will be active at all times. Your screen will start displaying a
message about the print queue being empty every time you boot your compu-
<page down> for more DOSSHELL
ter, but that's ok, that's what it's supposed to say because you haven't
told it yet what file you want to print.
Well that's about all I know about the version 4 DOS Shell. The one in
version 5, on the other hand, has some extra features over the old one.
Best of all, it's got a task switcher.
What's a task switcher? Well, you know how if you're in the middle of
one application and you need to get some information out of another? You
have to save whatever you're working on in the app you're in, and exit
it, and start up the other app, get the info you wanted from it, exit
that one, and start the first one back up, and find the point where you
had left off. Well, a task switcher allows you to have more than one app
open at a time, and switch back and forth between them. The ones that
are in the background aren't actually running. They're just sort of in
limbo, so it's not like running a multitasker. But it's a lot easier
than exiting and starting and exiting a bunch of applications.
When you swap from one application to another, everything that's in RAM
<page down> for more DOSSHELL
is copied to your hard drive for storage, so that when you switch back to
that app, whatever is now in memory is copied to a different swap file
and that first swap file on the hard drive is copied back into RAM and
you're right where you left off in that first app before you swapped to
the second one, and the second one is sitting on the hard drive ready for
you to swap back into it.
All you have to do to be able to do task switching with version 5.0's
Shell, is to pull down the Options menu and put your cursor on Enable
Task Swapper and hit the <Enter> key. That should put a little diamond
on that line right next to the Enable Task Swapper option, and now you
can start one program, then hit <Ctrl-Esc> to get back to the DOS Shell,
and start another program, etc.
The task swapper uses whatever directory is referenced by the TEMP vari-
able in your environment, so if you have enough memory to make a really
big (at least one meg) RAMdisk, and supposing that your |sRAMdisk|s's drive
letter is E:, then put SET |sTEMP|s=E:\ into your AUTOEXEC.BAT, then the task
swapper will put all its swap files there. (Until the RAMdisk fills up,
<page down> for more DOSSHELL
that is. If you have a whole bunch of applications active at once, then
the overflow will go into your C:\DOS directory.) Two benefits of this:
First, a RAMdisk is about a million times faster than a hard drive. And
second, the |nDOSSHELL|n and the task swapper are all the time creating these
little temporary files and leaving them lay around in whatever directory
is listed in your TEMP variable. Those files automatically get deleted
whenever you exit the application involved or the |nDOSSHELL|n itself. But
sometimes your machine locks up and you have to reboot it, so those temp
files don't get deleted. Well if they're on the RAMdisk, then the temp
files don't just hang around waiting for you to find them and start won-
dering where they came from, because everything on a RAMdisk is erased
when you reboot. So those files are gone, out of your way.
The |nDOSSHELL|n is a really good candidate as a program that can be run from
a RAMdisk to speed it up. To do so, make sure the |sRAMdisk|s's root dir-
ectory is the very first directory listed on your PATH, and then put the
line COPY C:\DOS\DOSS*.* E:\ into your AUTOEXEC.BAT file (that's again
assuming your RAMdisk is drive E:), and that way, whenever you issue the
<page down> for more DOSSHELL
|nDOSSHELL|n command, DOS will run the copy that's on the fast RAMdisk in-
stead of the copy of the program that's on the slow hard disk. But, one
thing you want to remember if you do that, is if you make any changes to
the DOSSHELL's configuration, you will need to COPY the |nDOSSHELL|n.INI file
from your RAMdisk back to your C:\DOS directory before you turn off the
computer. Or else the changes you made will be gone the next time you
boot the computer.
If you have an EGA monitor you will want to install |tEGA.SYS|t, which is a
device driver that you use by putting a DEVIC|1E or DEVICEHIGH command into
your CONFIG.SYS file. Otherwise, every time you switch between one ap-
plication and another, it's likely that the screen will be all messed up.
Make absolutely sure that the Select Across Directories choice in the Op-
tions menu, is not enabled. Use that option only when you need to, and
remember to always turn it back off as soon as you're done with whatever
you needed it for! Otherwise, whatever filename the cursor was sitting
on when you first entered the Shell, will be one of the ones deleted, or
copied, or whatever, when you do anything that can affect more than one
<page down> for more DOSSHELL
file at a time. Really terrible things can happen to your files if you
leave Select Across Directories enabled!
With DOS 5.0's Shell, it's really easy to customize the colors exactly to
your own taste. Just use the EDIT command to edit the |nDOSSHELL|n.INI file,
go near the end where you can see a bunch of colors written, pick out one
of the combinations that you're sure you will never want to use, such as
hot pink, and change all its colors, save the file, and the next time you
go into |nDOSSHELL|n, choose the combination you edited, and it'll be the one
you created instead of the one that used to exist under that name. You
want to be careful how you change it though. I mean if you want to
change blue to green, then change all of the blues to green, and don't
change anything else to green. The same for any other color. Because if
you accidentally change, say, the foreground of the menus to red and
change the background of the menus to red as well, you won't be able to
read a word of the menus.
Speaking of colors, if you use ANSI.SYS and ESC sequences to change the
colors of your DOS screen, the Shell will probably mess them up when you
<page down> for more DOSSHELL
exit back to DOS. If the color choice includes a colored background your
screen will be black, and just the prompt itself will be your chosen col-
ors when you exit the Shell. To fix that problem up, you just need the
CLS command. So if you use a DOSKEY macro like DS=DOSSHELL $T CLS then
your screen will get cleared for you, to the proper colors, each time you
exit the Shell. (I'm not sure why, but it even works when you haven't
actually exited the Shell, like when you use the <Shift-F9> or "Command
Prompt" options.)
If you run a program from within the Shell, that requires that you load
some TSR, then run the program, then unload the TSR, then when you exit
that program you'll get a screen that says something about "pop-up sup-
port" and tells you to press <Ctrl-C> to continue. That's ok, because
it's supposed to do that, to make sure that TSR that got loaded, gets
properly removed from memory before going back to the Shell.
You mustn't ever run commands such as CHKDSK with the /F switch, or DEL
or ERASE or UNDELETE or such things that affect the information on your
disk while you have another program running in the task switcher! Be-
<page down> for more DOSSHELL
cause you don't really have any way of knowing for sure what disk files
the other program has open at the time. Really awful things can happen
if you do those commands while another program is running.
Even CHKDSK without the /F switch will do funny things if run from in-
side the |nDOSSHELL|n. Because there are temp files open while the Shell is
in use, and CHKDSK will think that those are lost |scluster|ss. If you exit
the Shell with <F3>, then run CHKDSK again, it won't find any lost clus-
ters after all. What a relief, right? The MEM command also doesn't work
quite right from within the |nDOSSHELL|n.
You can make the Shell do anything you want it to do by adding a new item
to the menu. To do that, you choose "New" from the Files menu while your
cursor is on the Main Group. On the Properties window of the screen you
get when you do that, there's a space where you should enter the commands
you want the Shell to perform whenever you select this new menu item. In
that space, you can enter just about any commands you want, including the
use of environment variables, just like you were writing a batch file ex-
cept you can't use the GOTO and SHIFT commands, and you separate commands
<page down> for more DOSSHELL
with " ; " (a semicolon surrounded by spaces) instead of a touch of the
<Enter> key. And the @ symbol doesn't work in these "pseudo-batch files"
but that's ok because ECHO is automatically off. Be sure to notice the
Pause option on that Properties screen. If there's an X next to it (the
|sdefault|s) then when your "pseudo |sbatch|s" commands are done, you'll get a
"Press any key" message before you go back to the Shell. That's for in
case your command displays something on the screen at the end, that you
need to see. If your command doesn't do that, and you don't want it to
pause, hit the <Space> bar on that Pause option to remove the X.
If you run your programs by clicking on the executable filename in the
Shell's directory list window, you'll always get that "Press any key"
message and the only thing you can do about it, is create a menu item in
the Main Group window for that program and run it from there instead.
The DOS 5.0 Shell is not compatible with old mouse drivers. If the Shell
gives you a message about an incompatible mouse, believe it. A lot of
people choose the "ignore" option there, and end up having all sorts of
problems that don't seem to be related to the mouse, and they wonder why.
<page down> for more DOSSHELL
The Shell means it when it says the mouse driver is incompatible. Just
get a more recent version of mouse driver, either from your local BBS or
from the mouse manufacturer (it's almost always free of charge) and then
your Shell will work properly.
<page down> for The |nEDIT|n Command
The |TEDIT|T Command
This command is new with DOS 5.0, and if you hate EDLIN then you're going
to love this one! It's a full screen ASCII text editor, with pull-down
menus, mouse support, configurable colors, and on-line help.
You can't use this command if the |nQBASIC|n.EXE file is not in the same dir-
ectory with the |nEDIT|n.COM file, or else in a directory listed on your PATH
variable in the environment, or else in the current directory.
You can start the EDITor from within DOSSHELL, or at the command line.
From the shell, it's in the Main Group. From the prompt, just type |nEDIT|n
and the name of the file you want to edit. For example, |nEDIT|n CONFIG.SYS
or |nEDIT|n C:\WORD\LETTER.DOC or if you want to create a new file, just |nEDIT|n
will do.
To pull down a menu from within the EDITor, all you have to do is hit one
of the <Alt> keys, and the menu bar will light up. Choose the letter of
the menu you want to see, and there it is. Use the <Left> and <Right>
<page down> for more EDIT
arrow keys to move to a different menu, or use <Up> and <Down> to move
to a different selection. Hit <Enter> to make a selection. To go back
to editing without selecting a menu option, use <Esc>.
The |nEDIT|n command depends on the code in the |nQBASIC|n.EXE file for its op-
eration, and since the PC-DOS QBASIC command depends on some code in the
ROM of a true IBM brand computer, this means that PC-DOS's |nEDIT|n command
won't work on anything but a true IBM computer. So if you have a clone,
you'll have to have MS-DOS in order to use this command.
To get help, just put your cursor on the menu item for which you want
more information and press <F1>. If you need help in general about how
the EDITor works, when you first start it up, don't give a filename, and
you will see a screen that offers you a Survival Guide. Choose that.
Well, the chapter about the EDITor in the manual is so well done that be-
tween it and the online help, you won't need anything else from me about
it. Have fun!
<page down> for The |nEDLIN|n Line Editor
The |TEDLIN|T Line Editor
An awful lot of people go around these days saying that |nEDLIN|n is a lou-
sy rotten piece of junk. Well, ok, it's a pretty sad excuse for a text
editor, but until you get something better, |nEDLIN|n will work just fine.
It's free with DOS, after all. And it's not a bit hard to learn, like
everybody says it is. (If you have DOS version 5, use EDIT instead, be-
cause it's even easier!)
It's called a LINe EDitor because it works with one line of text at a
time. So it displays files with line numbers next to each line, and
these are the numbers you use to work with the lines.
The syntax of the command is really simple. You just type the command
followed by the name of the file you want to edit or create. If the file
is not in the current directory, you specify the |spath|sname as well as the
filename. For example,
|nEDLIN|n C:\AUTOEXEC.BAT
If you enter the |nEDLIN|n command with the /B switch, as in |nEDLIN|n FILE /B,
<page down> for more EDLIN
you can edit all of a file that has an End-of-File character embedded in
it. (See the section about the COPY command.) Because the /B, which
stands for Binary, means that |nEDLIN|n will look in the file's directory en-
try to see how long the file is, rather than just editing whatever comes
before the first End-of-File character, which would, by the way, remove
all the text that came after that End-of-File character if you were to
save the file back to disk after not using the /B switch. Also, |nEDLIN|n
does put the EOF character on the end of every file you edit with it!
|nEDLIN|n is especially good for working with AUTOEXEC.BAT and CONFIG.SYS
files, because |nEDLIN|n makes 100% ASCII files. If you were to use a word
processor to create these configuration files, you would have to remember
to save the file in the word processor's version of text, ASCII, or non-
document mode, because word processors insert all sorts of special sym-
bols into the file, to tell it where the margins are, where the words
should be in boldfaced type, things like that. If you tried to use a
file like that as a DOS file, DOS would just have a fit! DOS only wants
to deal with plain old straight ASCII text, and that's just what |nEDLIN|n
gives to DOS.
<page down> for more EDLIN
When you enter the above command, |nEDLIN|n AUTOEXEC.BAT, if the file already
exists you will see "End of input file", or if the file does not exist
yet, you will see "New file". Then you will see EDLIN's |nprompt|n, which is
just an asterisk (*).
Another use that |nEDLIN|n has for the asterisk is to mark the |ncurrent|n line.
The |ncurrent|n line is the one that was most recently edited. When you
first open a file, the |ncurrent|n line is line one. But after that, most
commands that you use will change the |ncurrent|n line to the one you per-
formed the command on. So that line will be the one with the asterisk.
Now if you enter a command without any line number, the command will be
performed on the |ncurrent|n line. Of course it's always safest to include
the line number in the command, but leaving it out and just having it
default to the |ncurrent|n line is a convenient shortcut for after you become
really familiar with |nEDLIN|n.
A line in |nEDLIN|n can be as long as 253 characters. If the text you are
putting on a line reaches the right edge of the screen, it will wrap
<page down> for more EDLIN
around to the next line of the screen, but it is still on the same line
number until you press <Enter> to end the line.
There are some special |tediting keys|t that you can use in |nEDLIN|n, and these
same keys can be used in the same way at the DOS command line as well.
The difference is that in |nEDLIN|n, these special keys allow you to bring
down the previous line and make changes to it, and in DOS these keys al-
low you to edit and re-execute the last command you entered. You see,
there is a thing called a "template", and in DOS, the template is DOS's
|nmemory|n of the last command you executed. In |nEDLIN|n, the template is DOS's
|nmemory|n of the last line that you edited, or if you're editing a line now,
then the template is the text that was at that line number before you
started changing it. Well the |nediting keys|n let you work with whatever is
in the template.
For example, the <F1> key will place the first character of the previous
line onto the |ncurrent|n line. Then if you hit the <F1> key again, the sec-
ond character from the previous line will be copied to the |ncurrent|n line.
The <F3> key copies the entire previous line, from the position of the
<page down> for more EDLIN
cursor to the end of the line, to the |ncurrent|n line. And the <F2> key,
followed by some character, copies all the characters from the previous
line, up until the character that you typed after the <F2> key. For ex-
ample, suppose you are editing line number 4:
4: Hello, there. How are you doing?
4:*_
Now if you were to hit the <F1> key five times, here's what you'd get:
4: Hello, there. How are you doing?
4:*Hello_
Then if you hit the <F2> key immediately followed by the <w> key:
4: Hello, there. How are you doing?
4:*Hello, there. Ho_
And if you hit the <F3> key, you'd get this:
4: Hello, there. How are you doing?
4:*Hello, there. How are you doing?_
Now suppose you wanted to change that line to "How the heck are you do-
ing?" First you'd hit <F2> <a> to copy all of the line up to the first
"a" down to the |ncurrent|n line. Then hit the <Insert> key to toggle the
insert mode on. Now everything you type will be inserted into the pre-
<page down> for more EDLIN
vious line. So type "the heck ". Then if you hit the <F3> key, the
words "are you doing?" will be copied to the |ncurrent|n line.
Then, suppose you decide you don't want that "the heck" in there after
all. So edit line four again and hit <F2> <t> <F2> <t>:
4: Hello, there. How the heck are you doing?
4:*Hello, there. How _
Now what you want to do is delete the next 8 characters, right? So just
hit the <Delete> key 8 times, and then <F3> and here's what you've got:
4: Hello, there. How the heck are you doing?
4:*Hello, there. How are you doing?_
Those same keys work the same way from one line number to the next. Sup-
pose you want to write some lines that look like this:
5: See page 428 for more information.
6: See page 486 for more information._
Well, to do that, you first write line number 5 like that, and then when
you get to line 6, just hit <F2> <2> and type <8> <6> and <F3>.
<page down> for more EDLIN
Now the <F4> key is also pretty interesting. It does pretty much the ex-
act opposite of the <F2> key. You type <F4> and some character key, and
all the characters up until that character you typed get deleted, and the
character you typed becomes the first character in the line, and the rest
of the line is copied to the |ncurrent|n line as well. For example:
4: Hello, there. How the heck are you doing?
4:*_
Now if you were to type <F1> <i> <F4> <,>, then you'd end up with this:
4: Hello, there. How the heck are you doing?
4:*Hi, there. How the heck are you doing?_
Ok, we also have the <F5> key. What that does is to copy the |ncurrent|n
line into the template without executing it. Without the <F5> key, the
only way to edit the |ncurrent|n line is to backspace over everything you've
already typed, change the little mistake, and then retype the rest of the
line again. Yuk. Well with <F5>, you can just put the line you're work-
ing on into the template, and then use the editing keys on it as if it
were the previous line instead of the |ncurrent|n line. The problem is, you
have to have a good |nmemory|n because as soon as you hit <F5>, the line dis-
<page down> for more EDLIN
appears from the screen. You have to remember what it said to be able to
edit it without seeing it. That's only the case at the DOS command line,
though. In |nEDLIN|n, the line doesn't disappear when you hit <F5>. Instead
a little @ symbol appears at the end, and the cursor moves down one line:
4:*Hello, there. How the hedk are you doing?@
_
See where the @ appeared when I hit <F5>? Now that whole line, except
for the @, is in the template and the cursor dropped down so I could try
again, without the typo. So if I hit <F2> <d> <c> <F3> then I have this:
4:*Hello, there. How the hedk are you doing?@
Hello, there. How the heck are you doing?_
Well that works the same way at the DOS command prompt, except that once
you hit <F5>, you can't see the line that you're editing like you can in
|nEDLIN|n.
Next, there is the <F6> key. This inserts a ^Z End-of-File character
into whatever you're typing. The main use you'll ever have for that is
when you're using COPY CON FILENAME to create a little text file without
using |nEDLIN|n or anything.
<page down> for more EDLIN
Then there's the <F7> key, which places a null character, ASCII code 0,
into your text. This will look like ^@ on the screen when you first type
it, but in general the null character is just a blank. It's useful for
causing the ECHO command to display a blank line during a batch file.
And last but not least, there's the <Esc> key, which will just cancel the
line you were typing and give you a blank line to start over on.
For the most part, you don't have to have anything to do with those edit-
ing keys if you don't want to. |nEDLIN|n works perfectly well without them.
They're just there to make life easier for you, but until you get the
hang of them you don't have to use them at all.
Another special key combination that can be useful in |nEDLIN|n, is <Ctrl-V>.
What that does, is to tell |nEDLIN|n that the next character you type should
be considered to be a control character. For example, if you were to
type <Ctrl-V> followed by the [ character, |nEDLIN|n would put ^[ into the
file, which represents the ESCape character, which is used to get the
attention of the ANSI.SYS device driver, or of your printer.
<page down> for more EDLIN
Another type of special character that you can enter into a file with ED-
LIN, is box-drawing characters. To enter an ASCII character number 206,
which looks like this, ╬, you just hold down the <Alt> key while typing
the numbers 2, 0, and 6 on the numeric keypad, then let go of the <Alt>
key. You can use these characters to make some decent-looking boxes and
menus. For example, the top line of a double box: ╔════════╦════════╗
Since everything you do in |nEDLIN|n depends on the line numbers of the text
lines, remember every time you change something, use the L or P command
to display the file again, to see what the new line numbers are. Because
whenever a line is inserted or deleted, that changes the line numbers for
all the lines after that point in the file. If you were to delete what
used to be line number 27, you'd be deleting the wrong line, because
since you inserted some other line before line 27, now what used to be
line 27 is now line 28. Always remember to redisplay the line numbers
after making any changes, before making any more changes.
Ok, here are the most-often-used |nEDLIN|n commands:
<page down> for more EDLIN
To edit a line that already exists, just enter its line number as a com-
mand. |nEDLIN|n will show you the line as it presently exists, and right un-
der that, a blank line with the same line number, which is where you type
what you now want the line to say. Hit <Enter> when you're done. Then
if you also want to edit the very next line, you can just hit <Enter>
again; you don't have to type the next line number first.
C (copy) To make another copy of some range of lines. If you wanted to
put another copy of lines 4 through 8 right before line 23, the command
to do that would be 4,8,23C.
D (delete) To delete a line or a range of lines. If you want to delete
the line that has number 6 beside it, the command would be 6D. If you
wanted to delete lines 6 through 12, the command would be 6,12D.
E (end) This is the command you use when you've got the file all done,
and you want to go back to DOS. |nEDLIN|n will make a backup copy of the
file the way it was before you started editing, and name that file with
the same name, only with a .BAK extension. Then it will save the file to
<page down> for more EDLIN
disk under the name you called it when you started the |nEDLIN|n command.
I (insert) This is the command you use to insert any line into a file.
If you've just started creating a brand new file, I is the first command
you want to use. If you're editing a file that already exists, and you
want to insert a line right before line number 6, then the command would
be 6I. If you want to add a line to the end of the file, the command
would be #I because the # symbol in |nEDLIN|n always means "the line number
right after the last line number that exists in the file". To insert a
line right before the |ncurrent|n line, use .I, because the . symbol in |nEDLIN|n
means the |ncurrent|n line. Or you could just use I because if no line num-
ber is specified, |nEDLIN|n |sdefault|ss to the |ncurrent|n line. When you're done
inserting lines, you get out of insert mode by using the <Enter> key to
make sure you're on a blank line, then you use the <Ctrl-C> combination.
This will take you back to the * |nprompt|n at the left edge of the screen,
where you can use any of the other |nEDLIN|n commands to do some more editing
or to display the file, or whatever you want to do.
L (list) This command is used to display the lines in the file. If you
<page down> for more EDLIN
want to display lines 8 through 15, the command would be 8,15L. If you
leave out the ending line number, and just type 8L, then |nEDLIN|n will dis-
play 23 lines starting with line 8. What's different between the L com-
mand and the P command, is that use of the L command does not change the
|ncurrent|n line number. If line 9 was |ncurrent|n before you used the L command
then line 9 will still be |ncurrent|n afterward.
M (move) This command can be used to move a line or a block of lines
from one location to another in a file. If you want to move the lines 3
through 16, to a position just before line 1, then the command would be
3,16,1M. If you only wanted to move line 3 to a position before line 1,
the command would be 3,3,1M. In that case, line 3 is both the starting
line and the ending line for the block of lines to be moved.
P (page) This command displays 23 lines of the file. If you use a line
number, as in 5P, then lines 5 through 27 will be displayed. But if you
leave out the line number, the |ncurrent|n line and the next 22 lines will be
displayed. When the P command is used, the last line displayed becomes
the |ncurrent|n line. Therefore, if you immediately give another P command,
<page down> for more EDLIN
without a line number, the next 23 lines will be displayed automatically.
Q (quit) This is the command to use to exit from |nEDLIN|n without saving
the file. If you've made a bunch of goofs, just enter Q and the copy of
the file on the disk will remain exactly as if you hadn't edited it at
all.
R (replace) This is the command you use to search-and-replace one
string of text with another. Suppose you want to change all of the oc-
currences of the word "Michael" between lines 5 and 32 with the word
"Mike". Here's the command:
5,32 ? RMichael<F6>Mike
The ? in that command causes |nEDLIN|n to stop and ask you, on each line that
contains the word "Michael", whether you really want to replace it with
"Mike". If you wanted to change all the occurrences of Mike Jones with
Mike, you could either use 5,32 ? RMike Jones<F6>Mike, or you could use
5,32 ? R Jones<F6> which would replace " Jones" with "nothing at all".
Notice that the only time you include a <Space> in the search string or
replace string, is when you want a <Space> to be one of the characters
<page down> for more EDLIN
that gets searched or replaced. Otherwise, there must never be a <Space>
right after the R command.
Whenever you hit the <F6> key, you will see ^Z on your screen. ^Z means
<Ctrl-Z> and <F6> is a shortcut for <Ctrl-Z>. So if for some reason you
can't use the <F6> key, like if you have used ANSI.SYS to reassign the
<F6> key to some other string, you can just use <Ctrl-Z> in its place.
S (search) This command will show you every line which contains the
text you want to search for. If you want to find every occurrence of the
word "Michael" from line 5 through line 32, the command would be:
5,32 ? SMichael
The ? makes |nEDLIN|n ask you, after displaying each line, if you want to end
the search or not. If you say Y(es), the line becomes the |ncurrent|n line
and the search ends. If you hit any key besides <Y>, the search contin-
ues. If you don't use the ? parameter |nEDLIN|n will only show you the first
occurrence of that text that it finds. Remember that the search is case
sensitive, so if you search for Michael, MICHAEL won't be found.
<page down> for more EDLIN
T (transfer) This command will import another ASCII file into the one
you're currently editing. This file has to be in the current directory,
though it doesn't have to be on the current drive. And it really does
have to be a pure ASCII file. Suppose you have a file named A:HELLO.TXT
and you want to insert it just before line 6 of the file you're editing,
6TA:HELLO.TXT
will do it.
For beginning of File 1, see What Is DOS?
|tAUTOEXEC.BAT|t|fSIMPLY1|f
|TCLS|T|fSIMPLY1|f
|TFAT|T|fSIMPLY1|f
|tUNDELETE|t|fSIMPLY1|f
|TWhat Is DOS?|T|fSIMPLY1|f
|tXCOPY|t|fSIMPLY1|f
|tBatch|t|fSIMPLY2|f
|TCALL|T|fSIMPLY2|f
|TECHO|T|fSIMPLY2|f
|TEXIST|T|fSIMPLY2|f
|TFIND|T|fSIMPLY2|f
|TGOTO|T|fSIMPLY2|f
|TIF|T|fSIMPLY2|f
|TMORE|T|fSIMPLY2|f
|TPAUSE|T|fSIMPLY2|f
|tRedirection|t|fSIMPLY2|f
|TSHIFT|T|fSIMPLY2|f
|TTEMP|T|fSIMPLY2|f
|T386|T|fSIMPLY3|f
|tBytes|t|fSIMPLY3|f
|tCache|t|fSIMPLY3|f
|tDEVICEHIGH|t|fSIMPLY3|f
|teXtended|t|fSIMPLY3|f
|tLOADHIGH|t|fSIMPLY3|f
|tMemory|t|fSIMPLY3|f
|TMEM|T|fSIMPLY3|f
|TPRINT|T|fSIMPLY3|f
|tqueue|t|fSIMPLY3|f
|tRAMdisk|t|fSIMPLY3|f
|TRAM|T|fSIMPLY3|f
|TRESTORE|T|fSIMPLY3|f
|TROM|T|fSIMPLY3|f
|TSUBST|T|fSIMPLY3|f
|tTSR|t|fSIMPLY3|f
|tANSI.SYS|t|fSIMPLY4|f
|tbad sector|t|fSIMPLY4|f
|tCONFIG.SYS|t|fSIMPLY4|f
|tDevice Driver|t|fSIMPLY4|f
|TDEVIC|1E|T|fSIMPLY4|f
|tEnvironment|t|fSIMPLY4|f
|tfloppy|t|fSIMPLY4|f
|TFORMAT|T|fSIMPLY4|f
|tIBMBIO.COM|t|fSIMPLY4|f
|tIBMDOS.COM|t|fSIMPLY4|f
|tIO.SYS|t|fSIMPLY4|f
|tLogical Drives|t|fSIMPLY4|f
|tmacros|t|fSIMPLY4|f
|tMSDOS.SYS|t|fSIMPLY4|f
|tPATH|t|fSIMPLY4|f
|tPROMPT|t|fSIMPLY4|f
|TSET|T|fSIMPLY4|f
|TSHELL|T|fSIMPLY4|f
|TC|1:|T|fSIMPLY5|f
|TCD|T|fSIMPLY5|f
|TCHDIR|T|fSIMPLY5|f
|TCOM1|T|fSIMPLY5|f
|tCOMMAND.COM|t|fSIMPLY5|f
|TCON|T|fSIMPLY5|f
|TCOPY|T|fSIMPLY5|f
|tcurrent|t|fSIMPLY5|f
|tdefault|t|fSIMPLY5|f
|TDEL|T|fSIMPLY5|f
|tDirectory|t|fSIMPLY5|f
|TDIR|T|fSIMPLY5|f
|TERASE|T|fSIMPLY5|f
|tExecutable|t|fSIMPLY5|f
|tinternal|t|fSIMPLY5|f
|TLPT1|T|fSIMPLY5|f
|TPRN|T|fSIMPLY5|f
|troot|t|fSIMPLY5|f
|tShelling Out|t|fSIMPLY5|f
|TTYPE|T|fSIMPLY5|f
|TVERIFY|T|fSIMPLY5|f
|t*.*|t|fSIMPLY6|f
|tASCII|t|fSIMPLY6|f
|TBBS|T|fSIMPLY6|f
|tbinary|t|fSIMPLY6|f
|tBoot|t|fSIMPLY6|f
|tcluster|t|fSIMPLY6|f
|tcommercial|t|fSIMPLY6|f
|tdecimal|t|fSIMPLY6|f
|tDisks|t|fSIMPLY6|f
|tdownloading|t|fSIMPLY6|f
|tfreeware|t|fSIMPLY6|f
|thexadecimal|t|fSIMPLY6|f
|tMagnetism|t|fSIMPLY6|f
|tParameters|t|fSIMPLY6|f
|tpublic domain|t|fSIMPLY6|f
|tReboot|t|fSIMPLY6|f
|tReplaceable|t|fSIMPLY6|f
|tsector|t|fSIMPLY6|f
|tShareware|t|fSIMPLY6|f
|tslack space|t|fSIMPLY6|f
|tWildcards|t|fSIMPLY6|f
|tWrite-protect|t|fSIMPLY6|f